settings
Installation
npm install @janiscommerce/settings
API
Settings.get(string) static
- This method returns settings or settings by key.
Example: Settings.get();
Example: Settings.get('database');
Setting file
The setting file is a JSON with all the settings.
It's located in path/to/root/[MS_PATH]/config/.janiscommercerc.json
.
[MS_PATH]
: ENV variable. Default is empty.
Example
{
"database": {
"core": {
"host": "my-host",
"user": "the-user"
},
"otherConn": {
"host": "my-other-host",
"user": "other-user"
}
},
"otherConfig": 123,
"mainPath": "/main/path/"
}
Usage
How to get settings
const Settings = require('janiscommerce/settings');
const settings = Settings.get();
How to get settings by key
const Settings = require('janiscommerce/settings');
const settings = Settings.get('database');